var password_protect_window = {

	focusElement: function(id) {
	  document.getElementById(id).focus("");
	},

	generatehash: function()
	{
  	var i = 0;
	  var concat = password_protect_window.getURL(document.getElementById("url").value) + document.getElementById("pass").value;

  	for (i = 0; i < 10000; i++)
	  {
  	  concat = Sha1.hash(concat);
	  }

  	document.getElementById("hash").value = concat;
	},

	getURL: function(url)
	{
	  url += "/";
  	if (url != "")
	  {
  	  double_slashes = url.search("//");
    	url = url.substr(double_slashes + 2);

	    length = url.length - url.search("/");
  	  url = url.substr(0, url.search("/"));

    	var pos = url.indexOf(".");

	    var temp_url_1 = url;
  	  var temp_url_2 = url.substring(pos + 1);

    	pos = temp_url_2.indexOf(".");

	    while (pos != -1)
  	  {
    	  temp_url_1 = temp_url_2;
      	temp_url_2 = temp_url_2.substring(pos + 1);
	      pos = temp_url_2.indexOf(".");
  	  }
    	return temp_url_1;
	  }

  	return "";
	}

}
